﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_Linkman_HaveInList]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_Linkman_HaveInList];
GO
CREATE PROCEDURE [dbo].[sproc_Linkman_HaveInList]
@type         int,
@staffid     int,
@id        int
/*-------------------------------------------
功能：检查此联系人是否在联系人列表中(返回1存在0不存在)
参数：
    @type        联系人类型(0:所有联系人1:员工联系人2:客户联系人3:自定义联系人)    
    @staffid    用户id
    @id        联系人id
---------------------------------------------*/
AS
    IF EXISTS (SELECT * FROM UDS_Linkman_LinkmanList WHERE LinkmanType=@type AND Staff_ID=@staffid AND LinkmanID=@id)
        RETURN 1
    ELSE
        RETURN 0